﻿Imports System
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports DotNetNuke
Imports DotNetNuke.UI.UserControls
Imports DotNetNuke.UI

Namespace NVPortal.Modules.NVNews

    Public MustInherit Class TinMoiHon
        Inherits Entities.Modules.PortalModuleBase
#Region "Controls"
#End Region

#Region "Event Handlers"

        Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Try
                If Not IsPostBack Then
                    Dim ctlNews As New NV_NewsController
                    Dim objNews As NV_NewsInfo
                    Dim arrCu As ArrayList
                    Dim arrMoi As ArrayList
                    Dim objCache As Object = CType(Cache.Get("Tinchitet"), Object)
                    objNews = ctlNews.GetByIDShow(Request.Item("tin"))

                    'Cac tin khac cung chuyen muc voi tin nay
                    arrCu = ctlNews.SelectNewsInSameCatCu(objNews.NewId, objNews.DateUpdate)
                    arrMoi = ctlNews.SelectNewsInSameCatMoi(objNews.NewId, objNews.DateUpdate)

                    Me.drgOtherNewsCu.DataSource = ctlNews.SelectNewsInSameCatCu(objNews.NewId, objNews.DateUpdate)
                    Me.drgOtherNewsCu.DataBind()

                    If arrCu.Count = 0 Then
                        Me.cuhon.Visible = False
                    End If
                    Me.drgOtherNewsMoi.DataSource = ctlNews.SelectNewsInSameCatMoi(objNews.NewId, objNews.DateUpdate)
                    Me.drgOtherNewsMoi.DataBind()
                    If arrMoi.Count = 0 Then
                        Me.moihon.Visible = False
                    End If
                    'ctlNews.NV_News_UpdateStaticPost((Request.Item("tin")))

                    Dim getCatID As String
                    getCatID = objNews.CategoryId
                    Dim idtintuc As String
                    idtintuc = Request.Item("c")
                End If
                Dim ctlFeedback As New NV_NewsFeedbackController
            Catch ex As Exception
                'Me.imgNews.Visible = False
                ' Exception
                ProcessModuleLoadException(Me, ex)
            End Try
        End Sub
        Public ReadOnly Property BasePage() As DotNetNuke.Framework.CDefault
            Get
                Return CType(Me.Page, DotNetNuke.Framework.CDefault)
            End Get
        End Property
        Public Function ReplaceChuoi(ByVal chuoi As String) As String
            Dim convert As String = Global.ReplaceChuoi.bodau(chuoi).Replace(" ", "-")
            Return convert
        End Function
        Public Function FormatURL(ByVal sitem As String, ByVal strID As String, ByVal strLink As String) As String
            Return "/" & sitem & "/" & strID & "/" & ReplaceChuoi(strLink) & ".htm"
        End Function
#End Region
        'phan trang
        Private Sub InitializeComponent()
        End Sub
        Protected Overrides Sub OnInit(ByVal e As EventArgs)
            InitializeComponent()
            MyBase.OnInit(e)
        End Sub
        'Het phan trang
    End Class

End Namespace
